package cn.hzking.gjmall.adpters;

import android.graphics.Color;
import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

import cn.hzking.gjmall.R;
import cn.hzking.gjmall.adpters.order.OrderDetailItemAdapter;
import cn.hzking.gjmall.bean.WuliuDetailBean;
import cn.hzking.gjmall.bean.order.OrderDetailBean;
import cn.hzking.gjmall.utils.ListUtils;
import cn.hzking.gjmall.utils.TimeManagement;

/**
 * Created by Administrator on 2018/3/2.
 */

public class WuliuDetailAdapter extends BaseQuickAdapter<WuliuDetailBean.DataBean.LogisticsDataBean.ContentBean,BaseViewHolder> {
    public WuliuDetailAdapter(int layoutResId, @Nullable List<WuliuDetailBean.DataBean.LogisticsDataBean.ContentBean> data) {
        super(layoutResId, data);
    }



    @Override
    protected void convert(BaseViewHolder helper, WuliuDetailBean.DataBean.LogisticsDataBean.ContentBean item) {
        View oneline=helper.getView(R.id.line_one);
        View twoline=helper.getView(R.id.line_two);
        View circleView=helper.getView(R.id.view_circle);
        TextView contentTv=helper.getView(R.id.tv_content);
        TextView timeTv=helper.getView(R.id.tv_time);
        contentTv.setText(item.getContext());
        timeTv.setText(item.getTime());
        if(getData().size()>1){
            if(helper.getLayoutPosition()==0){
                oneline.setVisibility(View.INVISIBLE);
                twoline.setVisibility(View.VISIBLE);
                circleView.setBackgroundResource(R.drawable.shape_wuliu_fillcircle);
                contentTv.setTextColor(Color.parseColor("#3E846E"));
            }else if(helper.getLayoutPosition()!=getData().size()-1){
                oneline.setVisibility(View.VISIBLE);
                twoline.setVisibility(View.VISIBLE);
                circleView.setBackgroundResource(R.drawable.shape_wuliu_circle);
                contentTv.setTextColor(Color.parseColor("#1E463C"));
            }else {
                oneline.setVisibility(View.VISIBLE);
                twoline.setVisibility(View.INVISIBLE);
                circleView.setBackgroundResource(R.drawable.shape_wuliu_circle);
                contentTv.setTextColor(Color.parseColor("#1E463C"));
            }
        }else {
            oneline.setVisibility(View.INVISIBLE);
            twoline.setVisibility(View.INVISIBLE);
            circleView.setBackgroundResource(R.drawable.shape_wuliu_fillcircle);
            contentTv.setTextColor(Color.parseColor("#3E846E"));
        }

    }
}
